<template>
  <div class="bg">
    <div class="back" @click="back"><返回</div>
    <!-- <div class="head"><span>头像</span><van-uploader :after-read="afterRead" />
</div> -->
    <!-- <div>昵称</div> -->
    <div style="display: flex;position: relative;">
        <span style="position: absolute;z-index: 99;top: 9px;left: 320px;" >男</span>
    <van-cell is-link title="性别" @click="show = true" />
    <van-action-sheet
      v-model:show="show"
      :actions="actions"
      @select="onSelect"
    />
    </div>

    <button class="quit" @click="quit">退出当前账号</button>
  </div>
</template>

<script setup>
import router from "@/router";
import { showToast } from "vant";
import { ref } from "vue";

const show = ref(false);
const actions = [{ name: "保密" }, { name: "男" }, { name: "女" }];
const onSelect = (item) => {
  show.value = false;
  // showToast(item.name)
};

const back = () => {

  setTimeout(() => {
    router.push({
      name: "my",
    });
  }, 500);
  setTimeout(() => {
    console.log("刷新");
    window.location.reload();
  }, 600);
};


const quit = () => {
  console.log("退出登录");
  const isLogin = localStorage.getItem("isLogin");
  // localStorage.removeItem('key');
  localStorage.clear();
  console.log(isLogin);

  setTimeout(() => {
    router.push({
      name: "home",
    });
  }, 1500);
  setTimeout(() => {
    console.log("刷新");
    window.location.reload();
  }, 1600);
};
</script>

<style scoped>
.bg {
  /* border: 1px solid red; */
  width: 100%;
  height: 100%;
  background: #f2f2f2;
}
.back{
    line-height: 40px;
    height: 40px;
    color: #1989fa;
    background: white;
}
.quit{
    margin-top: 20px;
    width: 100%;
    padding: 15px;
    background: white;
    border: none;
}
.head{
    background: white;
    text-align: end;
}
.head span{
    margin-right: 280px;
}
/* .van-uploader__input{
    --van-uploader-size:20px;
} */
</style>